<?php
	require_once('auth.php');
?>
<?php
//checking connection and connecting to a database
require_once('connection/config.php');
//Connect to mysql server
	$link = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD);
	if(!$link) {
		die('Failed to connect to server: ' . mysql_error());
	}
	
	//Select database
	$db = mysql_select_db(DB_DATABASE);
	if(!$db) {
		die("Unable to select database");
	}
//count the number of records in the members, orders_details, and reservations_details tables
$members=mysql_query("SELECT * FROM members")
or die("There are no records to count ... \n" . mysql_error()); 
$orders=mysql_query("SELECT * FROM orders_details")
or die("There are no records to count ... \n" . mysql_error());
$reservations=mysql_query("SELECT * FROM reservations_details")
or die("There are no records to count ... \n" . mysql_error());
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Admin Index</title>
<link href="stylesheets/admin_styles.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="page">
<div id="header">
<h1>Administrator Control Panel</h1>
<a href="profile.php">Profile</a> | <a href="accounts.php">Accounts Management</a> | <a href="orders.php">Orders Management</a> | <a href="reservations.php">Reservation Management</a> | <a href="specials.php">Specials Management</a> | <a href="allocation.php">Staff Allocation Management</a> | <a href="messages.php">Messages Management</a> | <a href="logout.php">Logout</a>
</div>
<div id="container">
<table width="800" align="center">
<CAPTION><h3>CURRENT STATUS</h3></CAPTION>
<tr>
<th>Number of Members Registered</th>
<th>Number of Orders Processed</th>
<th>Number of Reservations Created</th>
</tr>

<?php
$result1=mysql_num_rows($members);
$result2=mysql_num_rows($orders);
$result3=mysql_num_rows($reservations);
echo "<tr>";
echo "<td>" . $result1."</td>";
echo "<td>" . $result2."</td>";
echo "<td>" . $result3."</td>";
echo "</tr>";
?>
</table>
<hr>
<table width="800" align="center">
<CAPTION><h3>CUSTOMERS' RATINGS (100%)</h3></CAPTION>
<tr>
<th>Excellent</th>
<th>Good</th>
<th>Average</th>
<th>Bad</th>
<th>Worse</th>
</tr>

<?php
/*echo "<tr>";
echo "<td>" . $ExcellentRate."</td>";
echo "<td>" . $GoodRate."</td>";
echo "<td>" . $AverageRate."</td>";
echo "<td>" . $BadRate."</td>";
echo "<td>" . $WorseRate."</td>";
echo "</tr>";*/
?>
</table>
<hr>
</div>
<div id="footer">
<div class="bottom_addr">&copy; 2012 Pizza-Inn. All Rights Reserved</div>
</div>
</div>
</body>
</html>
